package cn.com.zsw.gblog.modules.rocketmq;

import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author shiwangzhou
 * @date 2021-05-02
 **/
@Component
@Slf4j
public class MqProducer {

    @Resource
    private RocketMQTemplate rocketMqTemplate;

    /**
     * @param message 消息
     * @param topic   目标topic
     * @return void
     * @author shiwangzhou
     * @date 2021-05-02 15:41
     **/

    public void sendMessage(String message, String topic) {
        rocketMqTemplate.convertAndSend(topic, message);
    }
}
